package svgedit.germangui.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;

import svgedit.germangui.GermanFrame;

/** Saves the document to the same file it was most recently saved/loaded
 *  from.
 */
@SuppressWarnings("serial")
public class SaveDocumentAction extends AbstractAction {

    private GermanFrame germanFrame;

    /** Create this action for the given frame */
    public SaveDocumentAction(GermanFrame germanFrame) {
        super("Speichern");
        this.germanFrame = germanFrame;
    }

    public void actionPerformed(ActionEvent ae) {
        // If there's no file yet, show the save as dialog
        if (germanFrame.getDocument().getFile() == null)
            new SaveDocumentAsAction(germanFrame).actionPerformed(ae);
        else
        	germanFrame.saveFile(germanFrame.getDocument().getFile());
    }


}
